import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import { RouteConfigSingleView } from 'vue-router/types/router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfigExt> = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router

export interface RouteConfigExt extends RouteConfigSingleView {
  meta?: {
    icon?: string;
    lockIcon?: string;
    hidden?: boolean;
    title?: string;
    activePath?: string;
    permission?: string;
    routePermission?: string;
    autoPermission?: boolean;
    noCache?: boolean;
    affix?: boolean;

    __path?: string;
    __activePath?: string;
  };

}